import request from '@/utils/request'
import { remoteRequest } from '@/utils/remote'

// 查询房屋地震灾害风险评估列表
export function listHouse(id) {
  return request({
    url: '/fxfzaqbz/data/getBigDisaster?id=' + id,
    method: 'get',
  })
}

// 查询房屋地震灾害风险评估详细
export function getHouse(id) {
  return request({
    url: '/fxfzaqbz/data/getDisasterAssById?id=' + id,
    method: 'get'
  })
}

// 上传房屋地震灾害风险评估
export function uploadHouse(data) {
  return request({
    url: '/fxfzaqbz/data/saveDisasterAss',
    method: 'post',
    data: data
  })
}

// 上传房屋地震灾害风险评估图片
export function uploadHousePic(data) {
  return request({
    url: '/attachment/uploadFile',
    method: 'post',
    data: data
  })
}

// 修改房屋地震灾害风险评估
export function updateHouse(data) {
  return request({
    url: '/fxfzaqbz/data/updateDisasterAss',
    method: 'post',
    data: data
  })
}

// 删除房屋地震灾害风险评估
export function delHouse(id) {
  return request({
    url: '/fxfzaqbz/data/deleteDisasterAss?id=' + id,
    method: 'post'
  })
}

// 提交最终成果
export function firstSubmitDisasterAss(id) {
  return request({
    url: '/fxfzaqbz/data/firstSubmitDisasterAss?id=' + id,
    method: 'post',
  })
}

// 标题是否重复
export function titleCheck(data) {
  return remoteRequest('titleCheck', data, () => {
    return request({
      url: '/fxfzaqbz/data/ifRepetition',
      method: 'post',
      data: data
    })
  })
}

// 查询房屋地震灾害风险评估最终成果列表
export function listHouses(id) {
  return request({
    url: '/fxfzaqbz/data/getBigDisasterTwo?id=' + id,
    method: 'get',
  })
}

// 编辑描述
export function updataDescribe(data) {
  return request({
    url: '/fxfzaqbz/data/addDescribe',
    method: 'post',
    data: data
  })
}

// 移除数据
export function removeDisasterAss(id) {
  return request({
    url: '/fxfzaqbz/data/removeDisasterAss?id=' + id,
    method: 'post',
  })
}

// 提交
export function secondSubmitDisasterAss(ids) {
  return request({
    url: '/fxfzaqbz/data/secondSubmitDisasterAss/' + ids,
    method: 'post',
  })
}